package edu.kjxy.day03.synchronizedBlockLockAll.test3;

/**
 * 功能:
 * 作者:程序员欧阳子韩
 * 日期:2024/2/2 19:41
 */
public class Service {
    public void testMethod1(MyObject object) {
        synchronized (object){
            try {
                System.out.println("testMethod1____getLock time=" + System.currentTimeMillis() +
                        "run ThreadName=" + Thread.currentThread().getName());
                Thread.sleep(5000);
                System.out.println("testMethod1 releaseLock time=" + System.currentTimeMillis() +
                        "run ThreadName=" + Thread.currentThread().getName());
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }
}
